home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Examples / CFMExamples / ModApp / MakeFile < prev    next >
Encoding:
Makefile  |  1998-12-03  |  11.0 KB  |  322 lines  |  [TEXT/MPS ]

  1. # Makefile for "ModApp"
  2. # Written 11/28/93 by Richard Clark of Apple Developer University
  3. # Modified 8/11/94 by Brian Strull of Apple's Runtime Group to support CFM-68K runtime.
  4. #
  5. #
  6. # Usage:
  7. #  Use "make all" or "BuildProgram all" to build a "fat" version of the app and all tools
  8. #  Use "make ModApp" or "BuildProgram ModApp" to build a "fat" version of the app.
  9. #  Use "make ModApp -d SYM=on" to build with symbols, or edit the "SYM" variable
  10. #    below. (The -d flag also works with BuildProgram.)
  11. #  Use "make ModApp -d OPT=speed" to build a speed-optimized version, or edit the "OPT"
  12. #    variable below. (NOTE: SYM=on disables all optimizations.)
  13. #  Use "make :Modules":Clock" to build the "clock" module by itself (or substitute
  14. #    another module name.)
  15. #
  16. # General Philosophy:
  17. #   The build rules for tools tend to build a PowerPC version into :PowerPC:xxx.ppc 
  18. #   and a 68K version into :68K:xxx.68K.  We then use MergeFragment to combine the
  19. #   two PEF containers, and then rez in the general resources.  The make file
  20. #   can't currently build a 68K only or PowerPC only version since we do the
  21. #   rez step after the merge.
  22. #   The Macintosh Debugger 2.0 can read PowerPC XCOFF files and 68K NJ files
  23. #   directly, eliminating the need to convert these formats to SYM.  For an app
  24. #   or library named FOO, the debugger expects to find FOO.XCOFF and FOO.NJ, 
  25. #   respectively.  We set up the link steps such that that the target will result
  26. #   in these names by default to simplify setting up the debugger.
  27. #
  28. # Note:
  29. #    The "Mark" menu has been set up to show each major secion of the makefile
  30. #
  31. # Open Issues:
  32. #   Header file dependencies are not completely accurate.
  33. #   Resource file changes don't always force a rez step
  34. #
  35. # Change history
  36. #        11/28/93    RC        Original release
  37. #        12/20/93    RC        Added comments, simplified "SYM" and "OPT" options,
  38. #                            reset marks to the correct places
  39. #         1/13/94    RC        Added "cfrg.c" and "cfrg.h" -- the cfrg resource parser
  40. #         8/11/94    BLS        Modified for CFM-68K runtime.
  41. #         8/31/94    mcm        changed {deps} to {DepDir}{Default}.c for new make
  42. #
  43. #  
  44.  
  45. # -------------- Object files
  46. OBJECTS_68K = ∂
  47.         :68K:AppleEventHandlers.o ∂
  48.         :68K:ToolLoader.o ∂
  49.         :68K:ToolAPI.o ∂
  50.         :68K:Init.o ∂
  51.         :68K:main.o ∂
  52.         :68K:Menus.o ∂
  53.         :68K:cfrg.o ∂
  54.         :68K:Windows.o
  55.  
  56. OBJECTS_PowerPC = ∂
  57.         :PowerPC:AppleEventHandlers.c.o ∂
  58.         :PowerPC:ToolLoader.c.o ∂
  59.         :PowerPC:ToolAPI.c.o ∂
  60.         :PowerPC:Init.c.o ∂
  61.         :PowerPC:main.c.o ∂
  62.         :PowerPC:Menus.c.o ∂
  63.         :PowerPC:cfrg.c.o ∂
  64.         :PowerPC:Windows.c.o
  65.  
  66. XCOFFLibs    =     "{SharedLibraries}"InterfaceLib             ∂
  67.                 "{SharedLibraries}"StdCLib                     ∂
  68.                 "{SharedLibraries}"MathLib                     ∂
  69.                 "{PPCLibraries}"PPCCRuntime.o                 ∂
  70.                 "{PPCLibraries}"StdCRuntime.o
  71.  
  72. # Directories used by the build process
  73. SRC = :
  74. MSRC  = :ModuleSources:
  75. PPC = :PowerPC:
  76. 68K = :68K:
  77.  
  78. # -------------- Debugging & optimization control
  79. SYM = off  # Symbolic debugging: "on" or "off" (you can override with the "d- SYM=off" option to make)
  80. OPT = off  # Optimization: off, speed, size, or local (you can override with the "d- SYM=size" option to make)
  81.  
  82.  
  83. # -------------- Default build rules
  84. :68K: ƒ :        # Objects in the 68K folder depend on sources in the current folder
  85.  
  86. :PowerPC: ƒ :    # Objects in the PowerPC folder depend on sources in the current folder
  87.  
  88. .o ƒ .c            # 68K .o files depend on the sources
  89.     SC {DepDir}{Default}.c -model cfmseg -sym {SYM} -mbg full -i "{cincludes}" -i : -w 17  -o {targ}
  90.  
  91. .c.o ƒ .c        # PowerPC .c.o files depend on the sources
  92.     MrC {DepDir}{Default}.c -opt {OPT} -sym {SYM} -i : -w 17 -proto strict -o {targ}
  93.  
  94.  
  95. # -------------- Dummy rule to build everything
  96. all ƒ ModApp tools
  97.  
  98. # -------------- Build rules for a fat binary
  99. # We copy the PowerPC pef container into the data fork, 
  100. # and the segmented CFM-68K application into the resource
  101. # fork.  We then rez in the Application resources, and 
  102. # a CFRG.
  103.  
  104. ModApp ƒ :PowerPC:ModApp.ppc :68K:ModApp.68k  ModApp.r cfrg.r
  105.     duplicate -y -d :PowerPC:ModApp.ppc {targ}
  106.     duplicate -y -r :68K:ModApp.68k {targ}
  107.     Rez ModApp.r -append -o {targ}
  108.     Rez cfrg.r -append -o {targ}
  109.     SetFile -c 'moda' -a Bi {targ}
  110.     
  111.  
  112. # -------------- Build rules for a PowerPC version
  113.  
  114. :PowerPC:ModApp.ppc ƒ {OBJECTS_PowerPC}
  115.     PPCLink -sym {SYM} {Objects_PowerPC} {XCOFFLibs} -o {targ}
  116.     
  117. # Which files depend on which others?
  118. ModApp.h ƒ ToolAPI.h
  119. AppleEventHandlers.c.o ƒ ModApp.h Prototypes.h AppleEventHandlers.c
  120. ToolLoader.c.o ƒ ModApp.h Prototypes.h ToolAPI.h cfrg.h ToolLoader.c
  121. ToolAPI.c.o ƒ  ToolAPI.h  ToolAPI.c
  122. Init.c.o ƒ ModApp.h Prototypes.h Init.c
  123. main.c.o ƒ ModApp.h Prototypes.h main.c
  124. Menus.c.o ƒ ModApp.h Prototypes.h Menus.c
  125. Windows.c.o ƒ ModApp.h Prototypes.h Windows.c
  126. cfrg.c.o ƒ cfrg.h cfrg.c
  127.  
  128. # -------------- Build rules for a 68K version
  129.  
  130. :68K:ModApp.68k ƒƒ {OBJECTS_68K}
  131.     ILink -model cfmseg -xm e -c 'moda' ∂
  132.         -m main ∂
  133.         -mf -sym {SYM} ∂
  134.         {OBJECTS_68K} ∂
  135.         "{SharedLibraries}"StdCLib ∂
  136.         "{SharedLibraries}"InterfaceLib ∂
  137.         -o {targ}
  138.  
  139.  
  140. # Which files depend on which others?
  141. # ModApp.h ƒ ToolAPI.h -- already shown above
  142. AppleEventHandlers.o ƒ ModApp.h Prototypes.h AppleEventHandlers.c
  143. ToolLoader.o ƒ ModApp.h Prototypes.h ToolAPI.h cfrg.h ToolLoader.c
  144. ToolAPI.o ƒ  ToolAPI.h  ToolAPI.c
  145. Init.o ƒ ModApp.h Prototypes.h Init.c
  146. main.o ƒ ModApp.h Prototypes.h main.c
  147. Menus.o ƒ ModApp.h Prototypes.h Menus.c
  148. Windows.o ƒ ModApp.h Prototypes.h Windows.c
  149. cfrg.o ƒ cfrg.h cfrg.c
  150.  
  151.  
  152. # -------------- Build all tools
  153. tools ƒ :Modules:Clock :Modules:Simple :Modules:Button :Modules:GWorldTools :Modules:Koch :Modules:PowerResource
  154.  
  155. :PowerPC: ƒ :ModuleSources:
  156. GWorldTools.c.o ƒ ModApp.h Prototypes.h :ModuleSources:GWorldTools.c
  157.  
  158. :68K: ƒ :ModuleSources:
  159. GWorldTools.o ƒ ModApp.h Prototypes.h :ModuleSources:GWorldTools.c
  160.  
  161.  
  162. # -------------- Build the GWorldTools shared library
  163.  
  164. :Modules:GWorldTools ƒƒ :PowerPC:GWorldTools.ppc  :68K:GWorldTools.68K
  165.     delete -i {targ}
  166.     MergeFragment -x {deps} {targ} 
  167.     setfile -c 'cfmg' -t 'shlb' {targ}
  168.  
  169. :PowerPC:GWorldTools.ppc ƒ :PowerPC:GWorldTools.c.o
  170.     PPCLink {deps} "{SharedLibraries}"InterfaceLib ∂
  171.         -sym {SYM}  ∂
  172.         -export GetGlobalBounds,AllocateBuffer,LockBuffer,UnlockBuffer,UpdateBuffer,DisposeBuffer,CopyBufferToWindow ∂
  173.         -xm SharedLibrary ∂
  174.         -o {targ}
  175.     MergeFragment -n GWorldTools -c -t pwpc -x {targ}  # use MergeFragment to create a library cfrg
  176.  
  177. :68K:GWorldTools ƒƒ :68K:GworldTools.o
  178.     ILink {deps} -o {targ} ∂
  179.         -model cfmseg -xm s -c moda ∂
  180.         -sym {SYM} -mf ∂
  181.         "{CFM68KLibraries}"NuMacRuntime.o ∂
  182.         "{SharedLibraries}"StdCLib ∂
  183.         "{SharedLibraries}"InterfaceLib 
  184.         
  185. :68K:GWorldTools.68K ƒƒ :68K:GWorldTools
  186.     MakeFlat {deps} -o {targ}
  187.     MergeFragment -n GWorldTools -c -t m68k -x {targ}  # use MergeFragment to create a library cfrg
  188.  
  189. # -------------- Build the Clock tool
  190.  
  191. :68K:Clock ƒƒ :68K:Clock.o :Modules:GWorldTools
  192.     ILink {deps} -o {targ} ∂
  193.         -model cfmseg -xm s -c moda ∂
  194.         -m ToolStartup  -sym {SYM} -mf ∂
  195.         "{CFM68KLibraries}"NuMacRuntime.o ∂
  196.         "{SharedLibraries}"StdCLib ∂
  197.         "{SharedLibraries}"InterfaceLib
  198.  
  199. :68K:Clock.68K ƒƒ :68K:Clock
  200.     MakeFlat {deps} -o {targ}
  201.     Rez ModuleCFRG.r -a -o {targ} -d ARCH=∂'m68k∂' -d TOOLNAME=∂"Clock∂"  -d SystemSevenOrLater=1
  202.  
  203. :PowerPC:Clock.ppc ƒ :PowerPC:Clock.c.o :PowerPC:GWorldTools.ppc
  204.     PPCLink {deps} -o {targ} -main ToolStartup -sym {SYM} ∂
  205.         "{SharedLibraries}"MathLib ∂
  206.         "{SharedLibraries}"StdCLib ∂
  207.         "{SharedLibraries}"InterfaceLib
  208.     Rez ModuleCFRG.r -a -o {targ} -d ARCH=∂'pwpc∂' -d TOOLNAME=∂"Clock∂"  -d SystemSevenOrLater=1
  209.  
  210. :Modules:Clock ƒƒ :PowerPC:Clock.ppc  :68K:Clock.68K
  211.     delete -i {targ}
  212.     MergeFragment -x {deps} {targ} 
  213.     Rez :ModuleSources:Clock.r -a -o {targ} -d SystemSevenOrLater=1
  214.     setfile -c 'moda' -t 'modt' {targ}
  215.     
  216.  
  217. # -------------- Build the Simple tool
  218.  
  219.  
  220. :68K:Simple ƒƒ :68K:Simple.o
  221.     ILink {deps} -o {targ} ∂
  222.         -model cfmseg -xm s -c moda ∂
  223.         -m ToolStartup  -sym {SYM} -mf ∂
  224.         "{CFM68KLibraries}"NuMacRuntime.o ∂
  225.         "{SharedLibraries}"StdCLib ∂
  226.         "{SharedLibraries}"InterfaceLib
  227.  
  228. :68K:Simple.68K ƒƒ :68K:Simple
  229.     MakeFlat {deps} -o {targ}
  230.     Rez ModuleCFRG.r -a -o {targ} -d ARCH=∂'m68k∂' -d TOOLNAME=∂"Simple∂"  -d SystemSevenOrLater=1
  231.  
  232. :PowerPC:Simple.ppc ƒ :PowerPC:Simple.c.o
  233.     PPCLink {deps} -o {targ} -main ToolStartup -sym {SYM} ∂
  234.         "{SharedLibraries}"StdCLib ∂
  235.         "{SharedLibraries}"InterfaceLib
  236.     Rez ModuleCFRG.r -a -o {targ} -d ARCH=∂'pwpc∂' -d TOOLNAME=∂"Simple∂"  -d SystemSevenOrLater=1
  237.  
  238. :Modules:Simple ƒƒ :PowerPC:Simple.ppc  :68K:Simple.68K
  239.     delete -i {targ}
  240.     MergeFragment -x {deps} {targ} 
  241.     setfile -c 'moda' -t 'modt' {targ}
  242.     
  243.  
  244. # -------------- Build the Button tool
  245.  
  246. :68K:Button ƒƒ :68K:Button.o
  247.     ILink {deps} ∂
  248.         -o {targ} ∂
  249.         -model cfmseg -xm s -c moda ∂
  250.         -m ToolStartup  -sym {SYM} -mf ∂
  251.         "{CFM68KLibraries}"NuMacRuntime.o ∂
  252.         "{SharedLibraries}"StdCLib ∂
  253.         "{SharedLibraries}"InterfaceLib
  254.  
  255. :68K:Button.68K ƒƒ :68K:Button
  256.     MakeFlat {deps} -o {targ}
  257.     Rez ModuleCFRG.r -a -o {targ} -d ARCH=∂'m68k∂' -d TOOLNAME=∂"Button∂"  -d SystemSevenOrLater=1
  258.  
  259. :PowerPC:Button.ppc ƒ :PowerPC:Button.c.o
  260.     PPCLink {deps} -o {targ} -main ToolStartup -sym {SYM} ∂
  261.         "{SharedLibraries}"StdCLib ∂
  262.         "{SharedLibraries}"InterfaceLib
  263.     Rez ModuleCFRG.r -a -o {targ} -d ARCH=∂'pwpc∂' -d TOOLNAME=∂"Button∂"  -d SystemSevenOrLater=1
  264.  
  265. :Modules:Button ƒƒ :PowerPC:Button.ppc  :68K:Button.68K
  266.     delete -i {targ}
  267.     MergeFragment -x {deps} {targ} 
  268.     Rez :ModuleSources:Button.r -a -o {targ} -d SystemSevenOrLater=1
  269.     setfile -c 'moda' -t 'modt' {targ}
  270.  
  271.  
  272. # -------------- Build the Koch tool
  273.  
  274. :68K:Koch ƒƒ :68K:Koch.o :Modules:GWorldTools 
  275.     ILink {deps} -o {targ} ∂
  276.         -model cfmseg -xm s -c moda ∂
  277.         -m ToolStartup  -sym {SYM} -mf ∂
  278.         "{CFM68KLibraries}"NuMacRuntime.o ∂
  279.         "{CFM68KLibraries}"NuMathLib.o ∂
  280.         "{SharedLibraries}"StdCLib ∂
  281.         "{SharedLibraries}"InterfaceLib 
  282.  
  283. :68K:Koch.68K ƒƒ :68K:Koch
  284.     MakeFlat {deps} -o {targ}
  285.     Rez ModuleCFRG.r -a -o {targ} -d ARCH=∂'m68k∂' -d TOOLNAME=∂"Koch∂"  -d SystemSevenOrLater=1
  286.  
  287. :PowerPC:Koch.ppc ƒ :PowerPC:Koch.c.o :PowerPC:GWorldTools.ppc
  288.     PPCLink {deps} -o {targ} -main ToolStartup -sym {SYM} ∂
  289.         "{SharedLibraries}"MathLib ∂
  290.         "{SharedLibraries}"StdCLib ∂
  291.         "{SharedLibraries}"InterfaceLib
  292.     Rez ModuleCFRG.r -a -o {targ} -d ARCH=∂'pwpc∂' -d TOOLNAME=∂"Koch∂"  -d SystemSevenOrLater=1
  293.         
  294. :Modules:Koch ƒƒ :PowerPC:Koch.ppc  :68K:Koch.68K
  295.     delete -i {targ}
  296.     MergeFragment -x {deps} {targ} 
  297.     Rez :ModuleSources:Koch.r -a -o {targ} -d SystemSevenOrLater=1
  298.     setfile -c 'moda' -t 'modt' {targ}
  299.     
  300.  
  301. # -------------- Build the PowerResource tool
  302. # This build is a little different, as we create a PEF file and then
  303. # read it into a TOOL resource in the module using a Rez script.
  304. # The 68K resources is built classic runtime, rather than model cfm-seg
  305.  
  306.  
  307. :PowerPC:PowerResource.ppc ƒ :PowerPC:PowerResource.c.o
  308.     PPCLink {deps} -o {targ} -main ToolStartup -sym {SYM} ∂
  309.         "{SharedLibraries}"InterfaceLib
  310.  
  311. :Modules:PowerResource ƒƒ :ModuleSources:PowerResource.r :PowerPC:PowerResource.ppc
  312.     Rez :ModuleSources:PowerResource.r -a -o {targ} -t modt -c moda -d SystemSevenOrLater=1
  313.  
  314. :Modules:PowerResource ƒƒ :68K:PowerResource.o
  315.     Link {deps} -o {targ} -t modt -c moda -rt TOOL -m ToolStartup -sg PowerResource -sym {SYM} -mf ∂
  316.     "{Libraries}"Interface.o
  317.     
  318. :68K:PowerResource.o ƒ :ModuleSources:PowerResource.c
  319.     SC {Deps} -proto strict -sym {SYM} -mbg full -i "{cincludes}" -i : -w 17 -o {targ}
  320.  
  321.